/** this app is used to write file*/
#include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include<unistd.h>
int main(void){
	int fd;
	int ret;
	fd=open("./test.txt",O_WRONLY | O_CREAT | O_EXCL,0644);//110 100 100
	if(-1 == fd){
		printf("open error\n");
		return 1;//sucess return 0; failed not 0
	}
	printf("open success\n");

	ret=write(fd,"hello world",11);
	if(-1==ret){
		printf("write error\n");
		close(fd);
		return 1;
	}
	printf("write success,%d bytes!\n",ret);
	close(fd);
	return 0;
}
